+2008-07-02 Kristian Rietveld <kris@imendio.com>
+
+ Bug 455268 - Add gtk-enable-tooltips GtkSetting
+
+ * gtk/gtk.symbols:
+ * gtk/gtktoolbar.[ch] (gtk_toolbar_[gs]et_tooltips): deprecated.
+
+ * gtk/gtksettings.c: introduce gtk-enable-tooltips XSetting.
+
+ * gtk/gtktooltip.c (_gtk_tooltip_handle_event): take the newly
+ introduced XSetting into account.
+
+ * demos/gtk-demo/appwindow.c: don't use the now deprecated
+ gtk_toolbar_set_tooltips().
+
2008-07-02 Cody Russell <bratsche@gnome.org>
Bug 541162 – [Win32] Update for the new GdkWindowImpl stuff
0, 0);
bar = gtk_ui_manager_get_widget (merge, "/ToolBar");
- gtk_toolbar_set_tooltips (GTK_TOOLBAR (bar), TRUE);
gtk_widget_show (bar);
gtk_table_attach (GTK_TABLE (table),
bar,
gtk_toolbar_get_relief_style
gtk_toolbar_get_show_arrow
gtk_toolbar_get_style
+#ifndef GTK_DISABLE_DEPRECATED
gtk_toolbar_get_tooltips
+#endif
gtk_toolbar_get_type G_GNUC_CONST
gtk_toolbar_insert
gtk_toolbar_new
gtk_toolbar_set_orientation
gtk_toolbar_set_show_arrow
gtk_toolbar_set_style
+#ifndef GTK_DISABLE_DEPRECATED
gtk_toolbar_set_tooltips
+#endif
gtk_toolbar_unset_style
#endif
#endif
PROP_FONTCONFIG_TIMESTAMP,
PROP_SOUND_THEME_NAME,
PROP_ENABLE_INPUT_FEEDBACK_SOUNDS,
- PROP_ENABLE_EVENT_SOUNDS
+ PROP_ENABLE_EVENT_SOUNDS,
+ PROP_ENABLE_TOOLTIPS
};
NULL);
g_assert (result == PROP_FONTCONFIG_TIMESTAMP);
-
+
/**
* GtkSettings:gtk-sound-theme-name:
*
GTK_PARAM_READWRITE),
NULL);
g_assert (result == PROP_ENABLE_EVENT_SOUNDS);
+
+ /**
+ * GtkSettings:gtk-enable-tooltips:
+ *
+ * Whether tooltips should be shown on widgets.
+ *
+ * Since: 2.14
+ */
+ result = settings_install_property_parser (class,
+ g_param_spec_boolean ("gtk-enable-tooltips",
+ P_("Enable Tooltips"),
+ P_("Whether tooltips should be shown on widgets"),
+ TRUE,
+ GTK_PARAM_READWRITE),
+ NULL);
+ g_assert (result == PROP_ENABLE_TOOLTIPS);
}
static void
* @enable: set to %FALSE to disable the tooltips, or %TRUE to enable them.
*
* Sets if the tooltips of a toolbar should be active or not.
+ *
+ * Deprecated: 2.14: The toolkit-wide #GtkSettings:gtk-enable-tooltips property
+ * is now used instead.
**/
void
gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
* gtk_toolbar_set_tooltips().
*
* Return value: %TRUE if tooltips are enabled
+ *
+ * Deprecated: 2.14: The toolkit-wide #GtkSettings:gtk-enable-tooltips property
+ * is now used instead.
**/
gboolean
gtk_toolbar_get_tooltips (GtkToolbar *toolbar)
GtkOrientation gtk_toolbar_get_orientation (GtkToolbar *toolbar);
void gtk_toolbar_set_orientation (GtkToolbar *toolbar,
GtkOrientation orientation);
+#ifndef GTK_DISABLE_DEPRECATED
gboolean gtk_toolbar_get_tooltips (GtkToolbar *toolbar);
void gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
gboolean enable);
+#endif /* GTK_DISABLE_DEPRECATED */
GtkToolbarStyle gtk_toolbar_get_style (GtkToolbar *toolbar);
void gtk_toolbar_set_style (GtkToolbar *toolbar,
GtkToolbarStyle style);
gtk_tooltip_hide_tooltip (tooltip);
}
+static gboolean
+tooltips_enabled (GdkWindow *window)
+{
+ gboolean enabled;
+ gboolean touchscreen;
+ GdkScreen *screen;
+ GtkSettings *settings;
+
+ screen = gdk_drawable_get_screen (window);
+ settings = gtk_settings_get_for_screen (screen);
+
+ g_object_get (settings,
+ "gtk-touchscreen-mode", &touchscreen,
+ "gtk-enable-tooltips", &enabled,
+ NULL);
+
+ return (!touchscreen && enabled);
+}
+
void
_gtk_tooltip_handle_event (GdkEvent *event)
{
gint x, y;
gboolean return_value = FALSE;
- gboolean touchscreen;
GtkWidget *has_tooltip_widget = NULL;
- GdkScreen *screen;
GdkDisplay *display;
GtkTooltip *current_tooltip;
- GtkSettings *settings;
-
- /* Disable tooltips in touchscreen mode */
- screen = gdk_drawable_get_screen (event->any.window);
- settings = gtk_settings_get_for_screen (screen);
- g_object_get (settings, "gtk-touchscreen-mode", &touchscreen, NULL);
- if (touchscreen)
+ if (!tooltips_enabled (event->any.window))
return;
/* Returns coordinates relative to has_tooltip_widget's allocation. */